import 'package:easy_read_comic/internal/http_client.dart';
import 'package:dio/dio.dart';

class BookApi {
  // 静态变量来保存唯一的实例
  static final BookApi _instance = BookApi._internal();

  // 私有构造函数
  BookApi._internal();

  // 工厂构造函数
  factory BookApi() {
    return _instance;
  }

  Future<Response> getList({int currentPage = 0}) async {
    return HttpClient().get("/v1/book/index?page=${currentPage}");
  }

  Future<Response> favourite(int comicId) {
    return HttpClient().post("/v1/book/favourite", data: {
      "comic_id": comicId,
    });
  }
}
